package com.zs.leymovie;

import android.app.Application;

import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.bitmap.BitmapGlobalConfig;
import com.zs.leymovie.utils.DiskCachePathUtils;


/**
 * Created by Administrator on 2015/8/4 0004.
 */
public class BaseApp extends Application {
    public boolean netStates;
    private static BaseApp app;

    private static DbUtils utils;

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        //初始化数据库

        initImageLoadGlobalConfig();
       // ShareSDK.initSDK(this);
    }
    public static BaseApp getInstance() {
        return app ;
    }
    private void initImageLoadGlobalConfig() {
        //设置磁盘缓存的路径
        BitmapGlobalConfig config =  BitmapGlobalConfig.getInstance(app, DiskCachePathUtils.getImageCache().toString());
    }

    //初始化数据库配置
    /*private void initDbconfig() {
        DbUtils.DaoConfig config = new DbUtils.DaoConfig(this);
        config.setDbDir(this.getCacheDir() + Config.SYSTEM_CACHE);
        config.setDbVersion(Config.DB_VERSION);
        config.setDbName(Config.DB_NAME);
        config.setDbUpgradeListener(new DbUtils.DbUpgradeListener() {
            @Override
            public void onUpgrade(DbUtils dbUtils, int i, int i1) {
            }
        });
    }*/

    //初始化数据库并创建表
    /*private void initCrudDB(){
        if(utils == null){
            utils = DbUtils.create(this);
        }
        try {
            utils.createTableIfNotExist(ShopInfo.class);

        } catch (DbException e) {
            e.printStackTrace();
        }
    }*/
}
